import sys

from PySide6.QtCore import Qt
from PySide6.QtWidgets import ( QApplication, QMainWindow, QHBoxLayout, QVBoxLayout, QWidget, QLabel )
from layout_colorwidget import Color

class MainWindow(QMainWindow):
    def __init__(self):
        super().__init__()

        self.setWindowTitle("My App")

        layout1 = QHBoxLayout()
        layout2 = QVBoxLayout()
        layout3 = QVBoxLayout()

        layout1.setContentsMargins(0, 20, 0, 20) # 布局编剧
        #layout1.setSpacing(20) # 元素之间间隔


        layout2.addWidget(Color(Qt.red))
        layout2.addWidget(Color(Qt.green))
        layout2.addWidget(Color(Qt.blue))

        layout1.addLayout(layout2)
        layout1.addWidget(Color(Qt.yellow))

        layout3.addWidget(Color(Qt.black))
        layout3.addWidget(Color(Qt.white))
        layout1.addLayout(layout3)

        widget = QWidget()
        widget.setLayout(layout1)

        self.setCentralWidget(widget)

app = QApplication(sys.argv)
window = MainWindow()
window.show()
app.exec()









